$(function() {
	// 首页banner
	var swiper_banner = new Swiper('.swiper-banner', {
		pagination: '.swiper-pagination',
		paginationClickable: true,
		loop : true,
		autoplay: 3000,
		autoplayDisableOnInteraction: false,
		onSlideChangeEnd: function(swiper) {
			$.imgloading.loading();
		}
	});
	// $('.swiper-banner').find(' .swiper-wrapper .swiper-slide a
	// img').width($(window).width());
	
   var swiper_bonus = new Swiper('.coupon-template');
	
	// 一行广告
	var swiper_ad = new Swiper('.one-ad-container', {
		pagination: '.one-ad-pagination',
		paginationClickable: true,
		autoplay: 5000,
		autoplayDisableOnInteraction: false,
		onSlideChangeEnd: function(swiper) {
			$.imgloading.loading();
		}
	})
	// 商城热点
	function comments_scroll() {
		var liLen = $('.hot ul li').length;
		var num3 = 0;
		$('.hot ul').append($('.hot ul').html());
		function autoplay() {
			if (num3 > liLen) {
				num3 = 1;
				$('.hot ul').css('top', 0);
			}
			$('.hot ul').stop().animate({
				'top': -60 * num3
			}, 500);
			num3++;
		}
		var mytime = setInterval(autoplay, 5000)
	}
	comments_scroll();
	// 推荐商品
	var goodsPromotion = new Swiper('.goods-promotion', {
		pagination: '.pagination',
		paginationClickable: true,
		preloadImages: true,
		lazyLoading : true,
		updateOnImagesReady:true,
		onSlideChangeEnd: function(swiper) {
			$.imgloading.loading();
		}
	// autoplay : 5000,//可选选项，自动滑动
	// loop : true,//可选选项，开启循
	});
	
	// 处理红包模板
	var bonus_ids = [];
	$.each($('.coupon-list'),function(){
		var bonus_id = $(this).data('bonus_id');
		if($.inArray(bonus_id,bonus_ids) == -1){
			bonus_ids.push(bonus_id);
		}
	});
	if(bonus_ids.length > 0){
		
		$.get('/shop/bonus/bonus-info',{
			ids : bonus_ids
		},function(result){
			
		});	
	}
	
});
